package com.ecoolex.chinadutyfree.retailer.ws;

import java.util.List;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.chinadutyfree.retailer.core.manager.DirectMailGoodsAuditManager;
import com.ecoolex.chinadutyfree.retailer.core.manager.DirectMailGoodsDeliveryMannerManager;
import com.ecoolex.chinadutyfree.retailer.core.manager.DirectMailGoodsDummyManager;
import com.ecoolex.chinadutyfree.retailer.core.manager.DirectMailGoodsManager;
import com.ecoolex.chinadutyfree.retailer.core.manager.DirectMailGoodsMarketingManager;
import com.ecoolex.chinadutyfree.retailer.core.manager.DirectMailGoodsProductManager;
import com.ecoolex.chinadutyfree.retailer.entity.DirectMailGoods;
import com.ecoolex.chinadutyfree.retailer.entity.DirectMailGoodsAudit;
import com.ecoolex.chinadutyfree.retailer.entity.DirectMailGoodsDeliveryManner;
import com.ecoolex.chinadutyfree.retailer.entity.DirectMailGoodsDummy;
import com.ecoolex.chinadutyfree.retailer.entity.DirectMailGoodsMarketing;
import com.ecoolex.chinadutyfree.retailer.entity.DirectMailGoodsProduct;
import com.ecoolex.chinadutyfree.retailer.pojo.QueryDirectMailGoodsDTO;
import com.ecoolex.chinadutyfree.retailer.pojo.QueryDirectMailGoodsMarketingDTO;
import com.ecoolex.framework.common.exception.BizException;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.framework.common.pojo.Sorting;


@Service
public class DirectMailGoodsServiceImpl implements DirectMailGoodsService {

	@Autowired
	private DirectMailGoodsManager directMailGoodsManager;

	@Override
	public DirectMailGoods add(DirectMailGoods record, List<Integer> deliveryMannerList, String createUser) {
		return directMailGoodsManager.add(record, deliveryMannerList, createUser);
	}

	@Override
	public DirectMailGoods update(DirectMailGoods record, List<Integer> deliveryMannerList, String updateUser) {
		return directMailGoodsManager.update(record, deliveryMannerList, updateUser);
	}

	@Override
	public void delete(DirectMailGoods record, String updateUser) {
		directMailGoodsManager.delete(record, updateUser);
	}

	@Override
	public DirectMailGoods offline(DirectMailGoods record, String updateUser) {
		return directMailGoodsManager.offline(record, updateUser);
	}

	@Override

	public DirectMailGoods release(DirectMailGoods record, String updateUser) {
		return directMailGoodsManager.release(record, updateUser);
	}
	
	@Override
	public DirectMailGoods agreeDirectMailGoodsRelease(DirectMailGoods record, String updateUser) throws BizException {
		return directMailGoodsManager.agreeDirectMailGoodsRelease(record, updateUser);
	}

	@Override
	public DirectMailGoods refuseDirectMailGoodsRelease(DirectMailGoods record, String auditOpinion, String updateUser) throws BizException {
		return directMailGoodsManager.refuseDirectMailGoodsRelease(record, auditOpinion, updateUser);
	}

	@Override
	public DirectMailGoods getById(Integer directMailGoodsId) {
		return directMailGoodsManager.getById(directMailGoodsId);
	}

	@Override
	public Pagination<DirectMailGoods> query(QueryDirectMailGoodsDTO query, Sorting[] sorts, Page page) {
		return directMailGoodsManager.query(query, sorts, page);
	}
	
	@Autowired
	private DirectMailGoodsAuditManager directMailGoodsAuditManager;
	
	@Override
	public DirectMailGoodsAudit getAudit(Integer auditId) {
		return directMailGoodsAuditManager.get(auditId);
	}

	@Override
	public Pagination<DirectMailGoodsAudit> queryAudit(Sorting[] sorts, Page page) {
		return directMailGoodsAuditManager.query(sorts, page);
	}

	@Autowired
	private DirectMailGoodsProductManager directMailGoodsProductManager;

	@Override
	public DirectMailGoodsProduct addProduct(DirectMailGoods goods, DirectMailGoodsProduct mailGoodsProduct, String createUser) {
		return directMailGoodsProductManager.add(goods, mailGoodsProduct, createUser);
	}

	@Override
	public DirectMailGoodsProduct updateProduct(DirectMailGoodsProduct mailGoodsProduct, String updateUser) {
		return directMailGoodsProductManager.update(mailGoodsProduct, updateUser);
	}

	@Override
	public void deleteProduct(DirectMailGoodsProduct mailGoodsProduct, String updateUser) {
		directMailGoodsProductManager.delete(mailGoodsProduct, updateUser);
	}

	@Override
	public DirectMailGoodsProduct getProductById(Integer directMailProductId) {
		return directMailGoodsProductManager.getById(directMailProductId);
	}

	@Override
	public List<DirectMailGoodsProduct> queryProductAllStatusByDirectMailGoodsId(Integer directMailGoodsId) {
		return directMailGoodsProductManager.queryAllStatusByDirectMailGoodsId(directMailGoodsId);
	}
	
	@Override
	public List<DirectMailGoodsProduct> queryNormalProductByDirectMailGoodsId(Integer directMailGoodsId){
		return directMailGoodsProductManager.queryNormalByDirectMailGoodsId(directMailGoodsId);
	}
	
	@Override
	public Long sumStockNumberByDirectMailGoodsId(Integer directMailGoodsId) {
		return directMailGoodsProductManager.sumStockNumberByDirectMailGoodsId(directMailGoodsId);
	}
	
	@Override
	public Long sumUsedStockNumberByDirectMailGoodsId(Integer directMailGoodsId) {
		return directMailGoodsProductManager.sumUsedStockNumberByDirectMailGoodsId(directMailGoodsId);
	}
	
	@Override
	public Long sumSoldNumberByDirectMailGoodsId(Integer directMailGoodsId) {
		return directMailGoodsProductManager.sumSoldNumberByDirectMailGoodsId(directMailGoodsId);
	}

	@Autowired
	private DirectMailGoodsDeliveryMannerManager directMailGoodsDeliveryMannerManager;

	@Override
	public List<DirectMailGoodsDeliveryManner> queryDeliveryMannerByDirectMailGoodsId(Integer directMailGoodsId) {
		return directMailGoodsDeliveryMannerManager.queryByDirectMailGoodsId(directMailGoodsId);
	}

	@Autowired
	private DirectMailGoodsDummyManager directMailGoodsDummyManager;

	@Override
	public DirectMailGoodsDummy updateDummy(DirectMailGoodsDummy record, String updateUser) {
		return directMailGoodsDummyManager.update(record, updateUser);
	}

	@Override
	public DirectMailGoodsDummy getDummyByDirectMailGoodsId(Integer directMailGoodsId) {
		return directMailGoodsDummyManager.getByDirectMailGoodsId(directMailGoodsId);
	}

	@Autowired
	private DirectMailGoodsMarketingManager directMailGoodsMarketingManager;

	@Override
	public DirectMailGoodsMarketing addMarketing(DirectMailGoodsMarketing record, String createUser) {
		return directMailGoodsMarketingManager.add(record, createUser);
	}

	@Override
	public DirectMailGoodsMarketing updateMarketing(DirectMailGoodsMarketing record, String updateUser) {
		return directMailGoodsMarketingManager.update(record, updateUser);
	}

	@Override
	public void deleteMarketing(DirectMailGoodsMarketing record, String updateUser) {
		directMailGoodsMarketingManager.delete(record, updateUser);
	}

	@Override
	public DirectMailGoodsMarketing getMarketingById(Integer id) {
		return directMailGoodsMarketingManager.getById(id);
	}

	@Override
	public Pagination<DirectMailGoodsMarketing> queryMarketing(QueryDirectMailGoodsMarketingDTO query, Sorting[] sorts, Page page) {
		return directMailGoodsMarketingManager.query(query, sorts, page);
	}
	
	@Override
	public boolean existMarketing(String position, String positionValue, Integer directMailGoodsId) {
		return directMailGoodsMarketingManager.exist(position, positionValue, directMailGoodsId);
	}

	@Override
	public Pagination<DirectMailGoods> queryRecommendDirectMailGoodsForH5(String position, String[] positionValue,
			Sorting[] sorts, Page page) {
		return directMailGoodsManager.queryRecommendForH5(position, positionValue, sorts, page);
	}

	@Override
	public Pagination<DirectMailGoods> queryDirectMailGoodsForH5(String customName, Sorting[] sorts, Page page) {
		return directMailGoodsManager.queryForH5(customName, sorts, page);
	}

	@Override
	public Pagination<DirectMailGoods> queryDirectMailGoodsByCategoryIdForH5(Integer categoryId, Sorting[] sorts,Page page) {
		return directMailGoodsManager.queryByCategoryIdForH5(categoryId, sorts, page);
	}

	@Override
	public Pagination<DirectMailGoods> queryDirectMailGoodsByFirstCategoryIdForH5(Integer categoryId, Sorting[] sorts, Page page) {
		return directMailGoodsManager.queryByFirstCategoryIdForH5(categoryId, sorts, page);
	}
	
	@Override
	public DirectMailGoods getByIdForH5(Integer directMailGoodsId) {
		return directMailGoodsManager.getByIdForH5(directMailGoodsId);
	}

	@Override
	public List<DirectMailGoods> getByGoodsId(Integer goodsId) {
		return directMailGoodsManager.getByGoodsId(goodsId);
	}

	@Override
	public Pagination<DirectMailGoods> queryByBrandId(String name,Sorting[] sorts,Integer brandId, Page page) {
		return directMailGoodsManager.queryByBrandId(name,sorts,brandId, page);
	}

}
